﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NightWolf.Sonar;

namespace Nuzzle.Database
{
    public static class DatabaseManager
    {
        public static bool Initialize()
        {
            try
            {
                if (Utilities.Settings.AppSettings.GetStringElement("Database.Username") == "root")
                    Utilities.Logger.Warning("Username 'root' is not safe, please change this !");
                SonarProvider.Initialize(SonardDatabase.MYSQL,
                    Utilities.Settings.AppSettings.GetStringElement("Database.Host"),
                    Utilities.Settings.AppSettings.GetStringElement("Database.Username"),
                    Utilities.Settings.AppSettings.GetStringElement("Database.Password"),
                    Utilities.Settings.AppSettings.GetStringElement("Database.Name"));
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}
